Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
Use std::prev for it rather than -1 in Syncengine
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
QString fileSlash = item->_file + '/';
auto forbiddenIt = _discoveryData->_forbiddenDeletes.upperBound(fileSlash);
if (forbiddenIt != _discoveryData->_forbiddenDeletes.begin())
- forbiddenIt -= 1;
+ forbiddenIt = std::prev(forbiddenIt);
if (forbiddenIt != _discoveryData->_forbiddenDeletes.end()
&& fileSlash.startsWith(forbiddenIt.key())) {
item->_instruction = CSYNC_INSTRUCTION_NEW;
// Start from the end (most recent) and look for our path. Check the time just in case.
auto begin = _touchedFiles.constBegin();
for (auto it = _touchedFiles.constEnd(); it != begin; --it) {
- if ((it-1).value() == fn)
- return std::chrono::milliseconds((it-1).key().elapsed()) <= s_touchedFilesMaxAgeMs;
+ if (const auto prevIt = std::prev(it); prevIt.value() == fn)
+ return std::chrono::milliseconds(prevIt.key().elapsed()) <= s_touchedFilesMaxAgeMs;
}
return false;
}